# _*_ coding:utf-8 _*_
# @File  : ruizy_security.py
# @Time  : 2022-01-10  14:22
# @Author: zizle

import os
from fastapi import APIRouter
from v1_all_api.all_response import AllResponse
from configs import APP_DIR

security_api = APIRouter()


@security_api.post('/publicKey/')  # 获取RSA加密公钥
async def get_rsa_public_key():
    public_file = os.path.join(APP_DIR, f'ini/public0.pem')
    with open(public_file, "r") as x:
        c = x.read()
    return AllResponse.operate_successfully({'publicKey': c})
